home *** CD-ROM | disk | FTP | other *** search
/ Multimedia Plus / Multimedia Plus with ClearVue Version 10-94 (Knowledge Media Inc.).ISO / win3x / pic_prsr / piclab / piclab.doc < prev    next >
Text File  |  1991-12-03  |  40KB  |  1,076 lines

  1. PICLAB.DOC
  2. December 3, 1991
  3.  
  4. Piclab 1.91 is a public domain image processing program by Lee
  5. Daniel Crocker and the Stone Soup Group.  It should be distributed
  6. with the following files:
  7.  
  8. PL.EXE          The program itself.
  9. PL286.EXE       Faster, smaller version for 286 (and up) machines.
  10. PICLAB.DOC      This file.
  11. PL.HLP          Text file for the HELP command.
  12. PICLAB.PIF      Windows 3.0 386 enhanced mode PIF.
  13. PICLAB.ICO      Windows 3.0 icon.
  14. GAMMA1.MAP  \
  15. GAMMA2.MAP   X  Color maps for viewing grayscale and pseudo-color.
  16. PSEUDO.MAP  /
  17. SSTOOLS.SMP     Sample SSTOOLS.INI file.
  18.  
  19. If you are missing one or more of these files, contact the author
  20. at one of the addresses listed at the end of this document.
  21.  
  22.  
  23.  
  24. Overview
  25. ========
  26.  
  27. Piclab operates on "images", so I will begin by explaining exactly
  28. what an image is and how Piclab classifies them.
  29.  
  30. For our purposes, an image is a data set that describes
  31. the reflectance of a 2-dimensional surface such as a photograph.  In
  32. particular, an image is a 2-dimensional array of "pixels" (a short
  33. form of "picture elements"), each of which contains data for the
  34. small rectangular area of the image it represents.
  35.  
  36. There are many systems in which image data represents "objects"
  37. rather than pixels.  PostScript is probably the most notable example. 
  38. The commands sent to a PostScript device tell it to draw lines or
  39. boxes or characters and let the device decide how it will perform the
  40. commands it gets.  Piclab does not deal with object-based images or
  41. devices.
  42.  
  43. Image data comes in several flavors, and while all are related in
  44. many ways, there are distinctions important to keep in mind.  I will
  45. divide image data into four classes: bitmapped, grayscale,
  46. golor-mapped, and true-color.  In all of these formats an image is
  47. represented as a rectangular array of pixels, each of which may
  48. contain some value.
  49.  
  50. Bitmapped images are collections of on/off dots.  That is, each pixel
  51. can be either "on" or "off", with no states in between.  This type of
  52. image can be displayed on just about any type of computer and is
  53. especially suited to printer output.  The disadvantages are the
  54. inability to represent color, and the lack of detail.  With large
  55. bitmapped images, one can get a surprising amount of detail by
  56. simulating shades of gray by dot patterns.  This process, called
  57. halftoning, is used by newspapers to print photographs.
  58.  
  59. At this time, Piclab does not deal directly with bitmapped images,
  60. although it can treat them as grayscale and can output images to
  61. bitmapped devices.
  62.  
  63. Grayscale images represent images by storing the intensity of light
  64. for each pixel on a scale of more than just on/off.  Typically, a
  65. grayscale image will allow 64 to 256 shades of gray at each pixel. 
  66. Very high quality renderings of black and white photographs can be
  67. stored in this format.
  68.  
  69. As an aside, the term "black and white" is often used to describe
  70. both bitmapped images and grayscale images.  For this reason, I will
  71. not use the term in this document.  Another common term for grayscale
  72. is "monochrome", which is often used to describe monitors that can
  73. display only shades of one color (often green or amber).
  74.  
  75. Color-mapped images are the ones most common on personal computers.
  76. Each pixel in an image is represented by a number (called an index)
  77. that is used to look up the pixel's actual color in a table (called
  78. the palette, much like an artist's palette).  These images are
  79. popular because they can be very colorful, yet take up less memory
  80. than full-color images (described next).  The size of the color
  81. palette varies among formats, but is typically 16 to 256.
  82.  
  83. True-color images are the highest quality representation, and the
  84. largest files as well.  Each pixel contains the complete color
  85. information for that pixel, usually expressed as the intensity of the
  86. red, green, and blue color components of the light at that location.
  87.  
  88. Piclab deals directly with grayscale, color-mapped and true-color
  89. images, regardless of the display capabilities of the hardware on
  90. which it is running.  In fact, Piclab can be used to enhance and
  91. print images on machines with no display at all.
  92.  
  93. I must stress that there is no connection between the images
  94. Piclab deals with and the type of display on your computer.  Piclab
  95. has a SHOW command that displays the image it is working with, but if
  96. the image is more detailed than your display can handle, Piclab will
  97. do its best to approximate the image on your display.  Regardless of
  98. what the display looks like, the image itself is always stored and
  99. operated upon in full detail.
  100.  
  101. So what's the point?  You might think that having image data more
  102. accurate than your computer can display is wasteful, but it is not. 
  103. One reason is that images get passed around to users of different
  104. machines, and the more accurate the image data, the better each
  105. machine will be able to display it.  You can also do things like
  106. print color images to a color printer even though you have no color
  107. display on your computer.  Lastly, hardware to display images as
  108. accurately as Piclab stores them does exist, and is becoming more
  109. affordable every day.  If you keep your images stored in their full
  110. accuracy, you will be better able to take advantage of any new
  111. hardware you may get.
  112.  
  113.  
  114.  
  115. General Operation
  116. =================
  117.  
  118. After starting Piclab by typing "PL" at the system command line, the
  119. user may enter any of a number of commands, each of which is
  120. performed immediately.
  121.  
  122. If you give arguments to the PL command, the first is taken as the
  123. name of a file containing Piclab commands, and the rest are treated
  124. as arguments to that program, accessed as %1, %2, etc., much like DOS
  125. batch file arguments.  This feature can be used to create programs
  126. for specific tasks.
  127.  
  128. Commands generally operate on two internal picture buffers called OLD
  129. and NEW.  Most commands start by deleting OLD and renaming NEW to
  130. OLD.  They then perform some transformation on OLD storing the result
  131. in NEW.  The command UNDO swaps NEW and OLD--effectively reversing
  132. the last operation.
  133.  
  134. OLD and NEW are stored on disk.  This decision was made primarily
  135. because my taste in pictures is better than my budget for RAM.  If
  136. you are dealing with simpler pictures, or if you have RAM to burn,
  137. you can direct Piclab to store OLD and NEW on a RAMdisk.  In MSDOS
  138. and similar operating systems, this is done by typing "SET TMP=D:" at
  139. the system command line before running Piclab, where D: is the drive
  140. or directory specification of the RAMdisk.
  141.  
  142. Piclab can read and write images in different file formats.  The LOAD
  143. command is used to read an image in one of these formats into the
  144. edit buffers.  The SAVE is used to write the contents of the edit
  145. buffers into one of these formats.  Every session with Piclab will
  146. generally begin with a LOAD, and end with a SAVE (or perhaps a PRINT)
  147. with some processing in between.  A file may be loaded from one file
  148. format and saved in a different one, thereby converting among formats.
  149.  
  150. Command parsing in Piclab is roughly like that of the system command
  151. line.  The line is broken into words that must be separated by
  152. spaces; the first word specifies the actual command and the remaining
  153. words are passed to the command handler as arguments.  The individual
  154. command-handling routines are responsible for interpreting their
  155. arguments.  Generally, a word may be shortened as long as it does not
  156. conflict with any other word in the same context. For example, the
  157. LIST COMMANDS command may be abbreviated LIS COM.
  158.  
  159. Any words in the command line that begin with the '%' character are
  160. replaced as follows: if the remainder of the word is a number, the
  161. word is replaced with the argument to the PL command in that position
  162. (starting with 0).  Otherwise, the word is replaced with the value of
  163. the DOS environment variable named by the word.  For example, here is
  164. a short Piclab program (named V2E) to convert a VGA 256-color image
  165. into an EGA 16-color image:
  166.  
  167. GLOAD %1
  168. UNMAP
  169. RESCALE 640 350
  170. EGAPAL
  171. MAP
  172. GSAVE %2
  173.  
  174. With this program in the current directory, typing "PL V2E IMG1 IMG2"
  175. will load IMG1.GIF, convert it to 16-color ega, and save that to
  176. IMG2.GIF.
  177.  
  178. Piclab has many settings that can be changed to accommodate the
  179. user's needs or environment.  From within Piclab, these are set with
  180. the SET command.  Because many of these will need to be set
  181. identically each time Piclab is run, a mechanism is proved for
  182. putting initial settings into a startup file.
  183.  
  184. This file, called SSTOOLS.INI, must be in a directory pointed to by
  185. the environment variables INIT or PATH.  It is a plain text file that
  186. contains initial settings and preferences for many of the Stone Soup
  187. tools.  The included file SSTOOLS.SMP is a good sample.  Edit it to
  188. suit your system, rename it SSTOOLS.INI, and place it where it can be
  189. found with the INIT or PATH environment variables.
  190.  
  191. Note that sections for each tool are marked by a line containing only
  192. the tool's name in square brackets.  The lines in the Piclab section
  193. can contain any variable normally set by the SET command, but note
  194. the different syntax: there is no SET, and the variable name and
  195. value are separated by an = sign rather than a space.
  196.  
  197.  
  198.  
  199. Commands
  200. ========
  201.  
  202. MAKEPAL
  203.  
  204. Syntax: MAKEPAL
  205.  
  206. Makes a palette appropriate for the NEW buffer.  Operates on only
  207. true-color images.  The variable PALETTE determines the number of
  208. colors in the new map, and the MAKEPAL command picks that many colors
  209. to best fit those in the image.
  210.  
  211. The MAP command must be used to map the image onto the palette.
  212.  
  213.  
  214. EGAPAL
  215.  
  216. Syntax: EGAPAL
  217.  
  218. Makes a 16-of-64-color palette appropriate for the NEW buffer.
  219. Operates on only true-color images.  This is designed primarily for
  220. reducing full-color images to a form better suited for display on
  221. an IBM EGA or similar device.
  222.  
  223. The MAP command must be used to map the image onto the palette.
  224.  
  225.  
  226. MAP
  227.  
  228. Syntax: MAP
  229.  
  230. Maps NEW buffer onto the current palette.  Operates only on true-color
  231. images, and produces a color-mapped image.  The variable DITHER
  232. determines whether each pixel is simply mapped onto the nearest color
  233. in the map, or whether dithering is used to achieve a more accurate
  234. mapping.  DITHER defaults to ON, and is recommended for most uses.
  235.  
  236. The MAKEPAL command should be used to create the best possible palette
  237. for the image before mapping, but any palette may be used for special
  238. purposes such as mapping several images to the same palette.
  239.  
  240.  
  241. PLOAD
  242.  
  243. Syntax: PLOAD file [offset [count]]
  244.  
  245. Loads a MAP file into the current palette.  First argument is the name
  246. of the MAP file which is assumed to be in the MAPDIR directory.  If a
  247. second argument is given, the palette is loaded starting at that index.
  248. If a third argument is given, only that many colors are loaded.
  249.  
  250. MAP files are plain text files that contain the RGB values for each
  251. palette index on one line.
  252.  
  253.  
  254. PSAVE
  255.  
  256. Syntax: PSAVE file [offset [count]]
  257.  
  258. Saves a MAP file from the current palette.  First argument is the name
  259. of the MAP file which is assumed to be in the MAPDIR directory.  If a
  260. second argument is given, the palette is loaded starting at that index.
  261. If a third argument is given, only that many colors are loaded.
  262.  
  263. This can be used to save a palette created with MAKEPAL so that it need
  264. not be calculated again, or so that it can be used with other images.
  265.  
  266. MAP files are plain text files that contain the RGB values for each
  267. palette index on one line.
  268.  
  269.  
  270. GRAYPAL
  271.  
  272. Syntax: GRAYPAL file [offset [count]]
  273.  
  274. Makes the specified MAP file the default colors used when displaying
  275. monochrome images or full-color images on a VGA.  The default colors
  276. are equivalent to GAMMA1.MAP, but GAMMA2.MAP and PSEUDO.MAP can be
  277. useful in some situations.
  278.  
  279. MAP files are plain text files that contain the RGB values for each
  280. palette index on one line.
  281.  
  282.  
  283. UNMAP
  284.  
  285. Syntax: UNMAP
  286.  
  287. Produces a true-color image from a color-mapped one.  This must be done
  288. before applying true-color transformations such as rescaling.  After
  289. transformations have been performed in true-color, the image may be
  290. reduced to a color-mapped one again with the MAKEPAL and MAP commands.
  291.  
  292.  
  293. HELP
  294.  
  295. Syntax: HELP [subject]
  296.  
  297. Looks like you have figured this one out already.
  298.  
  299.  
  300. CALL
  301.  
  302. Syntax: CALL program [args]...
  303.  
  304. Calls the external program named by its first argument passing along
  305. any subsequent arguments to that program.  Many programs do not
  306. release all of the memory given to them when they terminate, so
  307. Piclab will reserve a large portion of memory for itself before
  308. calling a program.  If you do not have much more memory than Piclab
  309. reserves, this may result in the program not being able to run in the
  310. memory left.
  311.  
  312. If this is a problem, you can use the DOS or SHELL commands to exit
  313. to DOS with all of the free memory available.
  314.  
  315.  
  316. CANCEL
  317.  
  318. Syntax: CANCEL
  319.  
  320. Cancels the most recent operation.  If there are point
  321. transformations pending that have not yet been saved with the
  322. TRANSFORM command, these are cancelled and no changes are made to the
  323. edit buffers.  Otherwise, the NEW and OLD buffers are exchanged.
  324.  
  325. There are some operations (like SAVE) that do not alter the edit
  326. buffers.  If one of these operations was the last one performed, UNDO
  327. will undo the operation before that.  No arguments.
  328.  
  329.  
  330. UNDO
  331.  
  332. Syntax: UNDO
  333.  
  334. Cancels the most recent operation.  If there are point
  335. transformations pending that have not yet been saved with the
  336. TRANSFORM command, these are cancelled and no changes are made to the
  337. edit buffers.  Otherwise, the NEW and OLD buffers are exchanged.
  338.  
  339. There are some operations (like SAVE) that do not alter the edit
  340. buffers.  If one of these operations was the last one performed, UNDO
  341. will undo the operation before that.  No arguments.
  342.  
  343.  
  344. SHELL
  345.  
  346. Syntax: SHELL [command]
  347.  
  348. Calls up the DOS command line.  All available memory is released to
  349. DOS when this command is given, and is reclaimed when DOS is exited.
  350. For this reason, some programs that cannot be CALLed may be run from
  351. with DOS.
  352.  
  353. Any arguments to this command will be passed to the system as a
  354. command line, and will cause it to return immediately after the
  355. command is done.  One particularly useful action of this program is
  356. "SHELL COPY /B PDAT PRN", which copies the print file to the printer.
  357. "SHELL DIR" can be used to view file directories when you want to see
  358. all files, not just pictures.
  359.  
  360.  
  361. DOS
  362.  
  363. Syntax: DOS [command]
  364.  
  365. Calls up the DOS command line.  All available memory is released to
  366. DOS when this command is given, and is reclaimed when DOS is exited.
  367. For this reason, some programs that cannot be CALLed may be run from
  368. with DOS.
  369.  
  370. Any arguments to this command will be passed to the system as a
  371. command line, and will cause it to return immediately after the
  372. command is done.  One particularly useful action of this program is
  373. "DOS COPY /B PDAT PRN", which copies the print file to the printer.
  374. "DOS DIR" can be used to view file directories when you want to see
  375. all files, not just pictures.
  376.  
  377.  
  378. QUIT
  379.  
  380. Syntax: QUIT [flag]
  381.  
  382. Exits Piclab.  If there is a point transformation pending, it must be
  383. cancelled or saved before exiting.  If the exit command is given any
  384. arguments, it exits immediately regardless of pending transformations.
  385.  
  386. Inside a program, QUIT merely sets a flag so that Piclab will exit after
  387. the program is complete.
  388.  
  389.  
  390. EXIT
  391.  
  392. Syntax: EXIT [flag]
  393.  
  394. Exits Piclab.  If there is a point transformation pending, it must be
  395. cancelled or saved before exiting.  If the exit command is given any
  396. arguments, it exits immediately regardless of pending transformations.
  397.  
  398. Inside a program, EXIT merely sets a flag so that Piclab will exit after
  399. the program is complete.
  400.  
  401.  
  402. LIST
  403.  
  404. Syntax: LIST [item]
  405.  
  406. If given without an argument, shows what things may can be listed.
  407. If one of these things (e.g. FORMATS, COMMANDS, BUFFERS) is given as
  408. an argument, the appropriate items are listed.  Especially useful are
  409. LIST COMMANDS if you forget the name of a command you are looking for
  410. and LIST BUFFERS to check the size and format of the image in the OLD
  411. and NEW edit buffers.
  412.  
  413.  
  414. PAUSE
  415.  
  416. Syntax: PAUSE [time]
  417.  
  418. With no arguments, Piclab waits for a key to be pressed before
  419. continuing.  If one argument is given, Piclab waits for that number
  420. of seconds (but will break early if a key is pressed).  This is for
  421. use within programs.
  422.  
  423.  
  424. PRINT
  425.  
  426. Syntax: PRINT [x-offset [y-offset]]
  427.  
  428. Prints the image in the NEW buffer into the file specified by the
  429. PRINTFILE variable.  The current setting of the PRINTER variable
  430. determines what codes are sent to the file.
  431.  
  432. Some versions of DOS do not correctly write to devices such as "prn"
  433. when opened as ordinary files.  For that reason, Piclab treats the
  434. PRINTFILE "" as a special case, and sends data directly to the
  435. printer rather than through DOS.
  436.  
  437. If arguments are given, the first two are used as the X and Y offsets
  438. of the first dot to print on the first page of output.
  439.  
  440.  
  441. RUN
  442.  
  443. Syntax: RUN program [args...]
  444.  
  445. Takes one argument--the name of a text file containing Piclab
  446. commands.  These are interpreted as if they had been typed from the
  447. command line, but they are not echoed, and messages are turned off
  448. while a program runs.  Subsequent arguments are passed along to the
  449. program as %1, etc.
  450.  
  451. A program can also be run by giving its name as an argument to the PL
  452. command when starting Piclab.
  453.  
  454.  
  455. SHOW
  456.  
  457. Syntax: SHOW [x-offset [y-offset]]
  458.  
  459. Used to display as much of the image in the NEW buffer as will fit on
  460. the computer's display screen.  If arguments are given, the first is
  461. used as a horizontal offset into the image buffer and the second as a
  462. vertical offset.  This can be used to look at different parts of an
  463. image too big for the screen.  Certain video modes allow scrolling
  464. with the arrow keys, but not all.  If no arguments are given, the
  465. current values of the XORIGIN and YORIGIN variables are used.
  466.  
  467. If any point transformations are pending, the image you see on screen
  468. reflects the image as it would be AFTER the pending transformation.
  469. This can be used to look at the effect of a transformation before
  470. saving or cancelling it.
  471.  
  472. Because Piclab often stores data more accurately than the display can
  473. render it, what you see on the screen is only an approximation of the
  474. actual image.  In particular, because Piclab does not yet support any
  475. true-color display hardware, true-color images will be shown in grayscale
  476. on displays capable of it, or in 8-color dither on others.
  477.  
  478.  
  479. SET
  480.  
  481. Syntax: SET [variable [value]]
  482.  
  483. Without any arguments, lists all Piclab variables and their current
  484. values.  Variables can be numbers, character strings, or TRUE/
  485. FALSE.  Variables set system defaults and control the specifics of
  486. how many commands perform.
  487.  
  488. If the set command is given one argument, the variable named is
  489. cleared.  That is, set to 0 if it is numeric, to "" if it is a
  490. string, and to FALSE if it is TRUE/FALSE.
  491.  
  492. If SET is given with two arguments, the variable named by the first
  493. is set to the value specified by the second.  If a numeric variable
  494. is given a string value, it is set to 0.  String values should not be
  495. put in quotes.  TRUE/FALSE values may be set by the keywords
  496. TRUE/FALSE, YES/NO, ON/OFF, or by the numeric values 1/0.
  497.  
  498. Within the SSTOOLS.INI file, the syntax is <variable>=<value>.
  499.  
  500. Help on individual variables is available by typing HELP <variable>.
  501.  
  502.  
  503. HISTOGRAM
  504.  
  505. Syntax: HISTOGRAM [RED | GREEN | BLUE]...
  506.  
  507. If no arguments are given, plots histograms for all planes; if one or
  508. more arguments are given, a histogram is plotted for each plane
  509. specified as an argument.  The histograms plotted reflect the image
  510. as it would be after any pending transformations, so you can look at
  511. the results of many processes before saving or cancelling them.
  512.  
  513. Each vertical bar of the histogram represents the total number of
  514. pixels in the image with values in the range beginning with the value
  515. listed below the histogram in hexadecimal.  Each bar covers a range
  516. of four values and there are 64 bars.  The height of each bar is in
  517. logarithmic proportion to the frequency of occurrence of values in
  518. the range it represents.  The bars are automatically scaled so that
  519. the tallest one is made 20 characters high.
  520.  
  521.  
  522. NEGATE
  523.  
  524. Syntax: NEGATE [RED | GREEN | BLUE]...
  525.  
  526. Arguments are handled as in HISTOGRAM.  Inverts each value in the
  527. lookup table for the planes specified.  This can be used after
  528. digitizing a negative or for special effects.
  529.  
  530.  
  531. DARKEN
  532.  
  533. Syntax: DARKEN [[RED | GREEN | BLUE] value]...
  534.  
  535. Subtracts a constant value to each point in the planes specified.  If
  536. only one argument is given, all planes are brightened by that amount.
  537. Otherwise, arguments are interpreted in order, and any arguments that
  538. specify planes determine which plane the next numerical argument will
  539. affect.  For example, DARKEN RED 10 BLUE 15 would subtract 10 from
  540. the values in the red plane and 15 from those in the blue.  Any
  541. values that would be taken out of the 0..255 range by the transform
  542. are clamped.
  543.  
  544. Because this darkening is a linear operation, the image to be
  545. brightened or darkened should be encoded with a gamma of 1.0.  That
  546. is, there should be a linear relationship between values in the image
  547. and intensities on the display.  If this is not the case, gamma
  548. correction may be applied with the GAMMA command before adjusting
  549. brightness.
  550.  
  551.  
  552. BRIGHTEN
  553.  
  554. Syntax: BRIGHTEN [[RED | GREEN | BLUE] value]...
  555.  
  556. Adds a constant value to each point in the planes specified.  If only
  557. one argument is given, all planes are brightened by that amount.
  558. Otherwise, arguments are interpreted in order, and any arguments that
  559. specify planes determine which plane the next numerical argument will
  560. affect.  For example, BRIGHTEN RED 10 BLUE 15 would add 10 to the
  561. values in the red plane and 15 to those in the blue.  Any values that
  562. would be taken out of the 0..255 range by the transform are clamped.
  563.  
  564. Because this brightening is a linear operation, the image to be
  565. brightened or darkened should be encoded with a gamma of 1.0.  That
  566. is, there should be a linear relationship between values in the image
  567. and intensities on the display.  If this is not the case, gamma
  568. correction may be applied with the GAMMA command before adjusting
  569. brightness.
  570.  
  571.  
  572. CONTRAST
  573.  
  574. Syntax: CONTRAST [[RED | GREEN | BLUE] value]...
  575.  
  576. This stretches or squeezes the contrast of an image.  Arguments are
  577. interpreted like those in BRIGHTEN.  If a given value is positive,
  578. the image contrast is stretched so that values that were equal to the
  579. given value become 0, and those that were equal to (255-value) become
  580. 255.  If the given value is negative, the inverse operation is
  581. performed.  Because contrast is always stretched equally around the
  582. midpoint of the range, it is a good idea to brighten or darken an
  583. image as necessary to center its histogram before performing a
  584. contrast stretch.
  585.  
  586. Also, the contrast stretching formula operates on color values
  587. assuming a linear relationship between these values and the
  588. intensities they represent (as do the BRIGHTEN and DARKEN commands). 
  589. Therefore, if an image has been scanned with a device with a gamma
  590. value not equal to 1.0, the image should be gamma corrected before
  591. contrast stretching.
  592.  
  593.  
  594. GAMMA
  595.  
  596. Syntax: GAMMA [[RED | GREEN | BLUE] value]...
  597.  
  598. The color values of the specified planes are adjusted so that values
  599. encoded for display on a monitor with a gamma value equal to the
  600. argument become linear.
  601.  
  602. For example, images encoded for display on PCs usually expect a
  603. monitor with a gamma near 2.0.  The GAMMA 2.0 command will convert
  604. these values to a linear scale.
  605.  
  606. Images encoded on Macintoshes and similar equipment have linear
  607. values already.  Such images can be adjusted for display on PCs with
  608. the inverse transformation, i.e. GAMMA 0.5.
  609.  
  610. See Piclab.DOC for more background on gamma correction.
  611.  
  612.  
  613. COLOR
  614.  
  615. Syntax: COLOR [mapfile]
  616.  
  617. Converts a grayscale image into a color-mapped image.  If the first
  618. argument is the name of a MAP file, the image is pseudo-colored with
  619. that map, otherwise the color map will contain the original grays.
  620.  
  621.  
  622. GRAY
  623.  
  624. Syntax: GRAY
  625.  
  626. Converts true-color or color-mapped image to grayscale.  The formula
  627. used for conversion to grayscale is the same as used by black and
  628. white televisions and is designed to mimic the eye's response: gray =
  629. (.299 * red) + (.587 * green) + (.114 * blue).
  630.  
  631.  
  632. TRANSFORM
  633.  
  634. Syntax: TRANSFORM
  635.  
  636. Saves the result of a series of point-process transformations to the
  637. edit buffer.  This must be done before any other transformation may
  638. be performed on the image.  If you wish to cancel the pending
  639. transformations without saving them, use UNDO or CANCEL.
  640.  
  641.  
  642. MEDIAN
  643.  
  644. Syntax: MEDIAN [WEIGHTED]
  645.  
  646. Reduces spot noise in an image.  Each point is replaced by the median
  647. of the points in its 3 x 3 area.  That is, the nine points in this
  648. area are sorted and the fifth one is taken.  If the one argument to
  649. this routine is WEIGHTED, then the center point is added twice more
  650. to the list and the sixth of the 11 points is taken.
  651.  
  652. The median filter results in some smoothing, but not as much as with
  653. the SMOOTH command.  This effect is a little less drastic with the
  654. weighted median filter.  Repeated application of this operation will
  655. result in an oil-paint texture appearing on the image.
  656.  
  657. This filter will not help reduce periodic or other noise--only small
  658. spot noise such as from dust on a lens.
  659.  
  660.  
  661. SHARPEN
  662.  
  663. Syntax: SHARPEN [value]
  664.  
  665. Applies what is called (somewhat inaccurately) a LaPlace transform to
  666. the image.  The effect is that edges in the image are sharpened as if
  667. the image had been re-focused.  Unfortunately, it also increases the
  668. amount of noise in the image, making it appear more grainy.
  669.  
  670. The command can be given a single numerical argument, which specifies
  671. the severity of the transform.  It is basically a tradeoff between
  672. sharpness and noise, and defaults to 1.0.  This value provides a
  673. noticeable increase in both sharpness and noise, and is about the
  674. best value for sharpening when the purpose is to bring out
  675. information.  When applying to a real image, a less severe value of
  676. .2 to .5 is often better.  Values greater than 1.0 should be used
  677. only when trying to locate specific objects in an image.  They
  678. produce too much noise for accurate reproduction.
  679.  
  680. This function works by amplifying the differences between each point
  681. and its neighbors.  This has the effect of amplifying high spatial
  682. frequency details such as edges and noise.
  683.  
  684.  
  685. SMOOTH
  686.  
  687. Syntax: SMOOTH [value]
  688.  
  689. Replaces each point with the average of the values of the nine points
  690. in its neighborhood.  This has the effect of smoothing the image and
  691. reducing high frequency effects like aliasing and noise, as well as
  692. high frequency details.  If an argument is given, it is taken as a
  693. value of the severity of the transform as with the SHARPEN command. A
  694. value of 1.0 is exactly as described.  Values less than 1.0 change
  695. the center value less than if a straight average had been done. 
  696. Values greater than 1.0 are not recommended.  If more smoothing is
  697. desired, perform SMOOTH more than once rather than with a high value.
  698.  
  699.  
  700. ADD
  701.  
  702. Syntax: ADD [WRAP]
  703.  
  704. Adds the OLD and NEW edit buffers storing the result in the NEW
  705. buffer.  If the only argument to the command is WRAP, then values
  706. that are taken out of the 0..255 range by the addition are taken mod
  707. 255; otherwise, values are clamped.
  708.  
  709.  
  710. SUBTRACT
  711.  
  712. Syntax: SUBTRACT [WRAP]
  713.  
  714. Subtracts the NEW edit buffers from the OLD buffer storing the result
  715. in the NEW buffer.  If the only argument to the command is WRAP, then
  716. values that are taken out of the 0..255 range by the addition are
  717. taken mod 255; otherwise, values are clamped.
  718.  
  719.  
  720. AVERAGE
  721.  
  722. Syntax: AVERAGE
  723.  
  724. Averages the OLD and NEW buffers, storing the result in NEW.  This
  725. can be used to reduce random digitizer noise by averaging the results
  726. of different samplings.  Can also be used to produce a double exposure
  727. effect when two different images are averaged.  No arguments.
  728.  
  729.  
  730. CLIP
  731.  
  732. Syntax: CLIP [x-size y-size]
  733.  
  734. If no arguments are given, image is clipped from (XORIGIN,YORIGIN) to
  735. lower right corner (upper right for bottom-up images).  If two
  736. arguments are given, the image is clipped from (XORIGIN,YORIGIN) to
  737. the horizontal and vertical size specified by the arguments.  XORIGIN
  738. and YORIGIN are set to 0 after this operation.  One argument is an
  739. error; more than two are ignored.
  740.  
  741.  
  742. EXPAND
  743.  
  744. Syntax: EXPAND x-size y-size [(BLACK | WHITE | value) [value]...]
  745.  
  746. This command increases the size of the image to the width and height
  747. specified by its first two arguments by adding extra rows and columns
  748. of pixels.  If a third argument is given, it can be either BLACK or
  749. WHITE to indicate what color the extra pixels should be.  If three
  750. numeric arguments are given after the bounds arguments, they are
  751. taken as the red, green, and blue value of the extra pixels. 
  752.  
  753. Multiple images can be placed in a montage by using EXPAND and
  754. OVERLAY.  Parts of an image may be joined with these functions as
  755. well, but it is not recommended for separately digitized image
  756. pieces, as no mosaicking is performed.
  757.  
  758. For color-mapped images, the third argument is treated as a color map
  759. index rather than a color value.
  760.  
  761.  
  762. MIRROR
  763.  
  764. Syntax: MIRROR
  765.  
  766. Flips the image horizontally.  No Arguments.
  767.  
  768.  
  769. OVERLAY
  770.  
  771. Syntax: OVERLAY [x-offset [y-offset [threshhold]]]
  772.  
  773. Overlays the image in the NEW buffer on top of the OLD buffer.  The
  774. image in the NEW buffer must not be larger than the image it is to
  775. overlay.  If two arguments are given, they are used as the horizontal
  776. and vertical offsets into the base image at which the overlay image
  777. is to be placed.  Otherwise, XORIGIN and YORIGIN are used.
  778.  
  779. If a third argument is given, all values in the overlaying image less
  780. than the give threshhold are treated as transparent.  This feature is
  781. primarily for grayscale and color-mapped images.  Using it on full
  782. color images produces bizarre results, because the threshholding is
  783. applied to each RGB component separately, rather than to the whole
  784. color value.
  785.  
  786.  
  787. RESCALE
  788.  
  789. Syntax: RESCALE value | (x-size y-size)
  790.  
  791. Resamples the image at a different resolution.  This is useful for
  792. scaling images up to a larger size for printing, or for scaling them
  793. down for display.  It is recommended that image data always be saved
  794. at its original sampling resolution to preserve as much data as
  795. possible and only scaled when necessary to conform to hardware.
  796.  
  797. If only one argument is given, horizontal and vertical resolution are
  798. both increased in the given proportion.  For example, if a 320 x 240
  799. image is in the NEW buffer when the command RESCALE 1.5 is given, the
  800. NEW buffer will contain the same image at 480 x 360.
  801.  
  802. More useful, though, is the case where two arguments are present.  In
  803. this case, the arguments are treated directly as the new horizontal
  804. and vertical resolution of the image.  The transformation above could
  805. be expressed as RESCALE 360 480.  This is most often used to
  806. compensate for differing aspect ratios.  For example, a 320 x 400
  807. from an Amiga can be rescaled to 320 x 200 to be viewed on a VGA, or
  808. to 720 x 540 for printing on the HP PaintJet.
  809.  
  810. Because RESCALE interpolates color values, it cannot be used on
  811. color-mapped images.
  812.  
  813.  
  814. REVERSE
  815.  
  816. Syntax: REVERSE
  817.  
  818. Changes the storage order of an image from top-down to bottom-up or
  819. vice versa.  This is used primarily to save an image loaded from a
  820. file in one format (like PCX) to a format requiring the opposite
  821. order (like GIF).
  822.  
  823. Targa files can be stored either way, and contain information in the
  824. header specifying which way they are stored.  Thus, any image can be
  825. saved in Targa format at any time with minimal memory usage.
  826.  
  827.  
  828. ROTATE
  829.  
  830. Syntax: ROTATE value
  831.  
  832. Rotates image in 90-degree increments.  The single argument is
  833. the number of degrees through which to rotate.  Only 90, 180, and
  834. 270 are currently supported (well, 0 and 360 work too, but they
  835. aren't very exciting.)
  836.  
  837. This is very useful for rotating screen-oriented images for printing
  838. on paper.  Because this operation requires large amounts of memory
  839. for large images, it is recommended in this case to rotate the image
  840. before scaling it up to size for printing.
  841.  
  842.  
  843. DIR
  844.  
  845. Syntax: DIR [directory]
  846.  
  847. Lists all files in the PICDIR directory in the current file format.  If
  848. an argument is given, files in that directory are listed.  No other
  849. file specifications can be given.  If FILEFORMAT is set to GIF or
  850. TARGA, statistics on the files will be listed as well.
  851.  
  852.  
  853. GDIR
  854.  
  855. Syntax: GDIR [directory]
  856.  
  857. Lists only GIF files from PICDIR or from the directory given as sole
  858. argument.  Statistics are listed from each file as well.
  859.  
  860.  
  861. TDIR
  862.  
  863. Syntax: TDIR [directory]
  864.  
  865. Lists only Targa files from PICDIR or from the directory given as
  866. sole argument.  Statistics are listed from each file as well.
  867.  
  868.  
  869. LOAD
  870.  
  871. Syntax: LOAD file [args]...
  872.  
  873. Loads a file in the current file format into the NEW buffer, moving
  874. the current contents of the NEW buffer to OLD.  Any arguments are
  875. passed along to the function that handles loading for the current
  876. format and are interpreted by that routine.  The first argument is
  877. always the file to be loaded, but other arguments vary with the format.
  878.  
  879. LIST FORMATS will give you a list of all the available file formats,
  880. and HELP is available for each.
  881.  
  882.  
  883. GLOAD
  884.  
  885. Syntax: GLOAD file
  886.  
  887. Loads image in GIF format regardless of the current setting of
  888. variable FILEFORMAT.  Sole argument is filename.
  889.  
  890.  
  891. TLOAD
  892.  
  893. Syntax: TLOAD file
  894.  
  895. Loads image in Targa format regardless of the current setting of
  896. variable FILEFORMAT.  Sole argument is filename.
  897.  
  898.  
  899. RLOAD
  900.  
  901. Syntax: RLOAD file x-size y-size [COLOR | MONO]
  902.  
  903. Loads image in RAW format regardless of the current setting of
  904. variable FILEFORMAT.  The width and height of the image must be
  905. specified as the second and third arguments to RLOAD.  A fourth
  906. argument may be either of the words COLOR or MONO to specify the
  907. number of planes.  COLOR is default.
  908.  
  909. Color-mapped RAW files must be loaded as MONO, then colored with the
  910. COLOR command after the palette is loaded with PLOAD.
  911.  
  912.  
  913. SAVE
  914.  
  915. Syntax: SAVE file [args]...
  916.  
  917. Saves the image in the NEW buffer to the file specified by the first
  918. argument.  Subsequent arguments are passed along to the file save
  919. routine of the current file format.
  920.  
  921. LIST FORMATS will give you a list of all the available file formats,
  922. and HELP is available for each.
  923.  
  924.  
  925. GSAVE
  926.  
  927. Syntax: GSAVE file [INTERLACE]
  928.  
  929. Saves the NEW buffer to the file named by the first argument in GIF
  930. format regardless of the current setting of variable FILEFORMAT.  If
  931. the second argument is the word INTERLACE, image is interlaced.
  932.  
  933.  
  934. TSAVE
  935.  
  936. Syntax: TSAVE file [bits]
  937.  
  938. Saves the NEW buffer to the file named by the first argument in Targa
  939. format regardless of the current setting of variable FILEFORMAT.  If
  940. the second argument is 16, 24, or 32, it is used as the number of
  941. bits per pixel stored in the file.
  942.  
  943.  
  944. RSAVE
  945.  
  946. Syntax: RSAVE file
  947.  
  948. Saves image in RAW format regardless of the current setting of
  949. variable FILEFORMAT.  No arguments.
  950.  
  951.  
  952.  
  953. Warnings and Errors
  954. ===================
  955.  
  956. "Command arguments ignored"
  957.  
  958.     This warning occurs when you give a command more arguments than it
  959.     needs.  Review the syntax of the command for an explanation.
  960.  
  961. "Open files were closed"
  962.  
  963.     This indicates that a command halted for some reason while files
  964.     were open.  Piclab has closed the files but data may be lost.
  965.  
  966. "Probable information loss"
  967.  
  968.     This warning is very common and should be taken lightly.  It
  969.     indicates that some transformation has been performed that is not
  970.     reversible.  Most of the time, the initial image will be safely
  971.     stored in a disk file, or recoverable with UNDO, so this is
  972.     unimportant.
  973.  
  974. "Assertion failure; contact author"
  975.  
  976.     The is printed only in places I think are unreachable.  This
  977.     message indicates a serious error, and action (such as saving the
  978.     working file and exiting the program) should be taken immediately.
  979.  
  980. "Insufficient memory"
  981.  
  982.     There is not enough memory to perform the command issued with the
  983.     current environment.  This is most common in frame processes like
  984.     ROTATE, and with GIF loading with MULTIIMAGE and MULTIMAP set ON. 
  985.     In the latter case, those variables can be set to OFF before
  986.     loading.  In the former, there is not much alternative but to clip
  987.     the image to a smaller size or try to provide more memory.
  988.  
  989. "Miscellaneous file I/O"
  990.  
  991.     File open or write failed.  Could be bad or full disk.  Retrying
  992.     may help.
  993.  
  994. "Unexpected end of file"
  995.  
  996.     File read failed.  This may occur when loading a file that is not
  997.     encoded in the correct format, or when loading a RAW or IP file
  998.     when the size is specified incorrectly.  CLIP may sometimes be used
  999.     to recover.
  1000.  
  1001. "LZW compression/decompression"
  1002.  
  1003.     Usually the result of a bad GIF file.
  1004.  
  1005. "Unrecognized file format or bad file"
  1006.  
  1007.     The LOAD command encountered something in the file not consistent
  1008.     with the file format being loaded.  Usually this is because you
  1009.     specified the wrong format, but may also occur on a bad or
  1010.     incorrectly encoded file.
  1011.  
  1012. "Image buffer empty"
  1013.  
  1014.     You attempted a transformation when no image is in the edit
  1015.     buffers.
  1016.  
  1017. "Point transform pending; issue TRANSFORM command"
  1018.  
  1019.     The command you issued cannot be performed until any pending point
  1020.     transformations are either saved with the TRANSFORM command or
  1021.     cancelled with the UNDO command.
  1022.  
  1023. "Illegal parameter values"
  1024.  
  1025.     This is a catch-all command syntax error.  Review the syntax of
  1026.     the command you are issuing.
  1027.  
  1028. "File not found"
  1029.  
  1030.     File open in LOAD command failed.  Check that the file is in the
  1031.     proper directory by issuing a DIR command.  Also check for correct
  1032.     spelling.
  1033.  
  1034.  
  1035.  
  1036. Acknowledgements
  1037. ================
  1038.  
  1039. Though I wrote 90% of the code, this project was definitely a group
  1040. effort.  The Graphics Support Forum Developer's Group on CompuServe
  1041. was instrumental in helping to inspire, create, optimize and test
  1042. this program.  I cannot acknowledge them all (or even name them all)
  1043. but a few deserve special mention:
  1044.  
  1045. John Bridges' Image Tools package served as an inspiration and a
  1046. performance yardstick for many of this program's functions, and some
  1047. of his generously donated code appears in the display code.  John is
  1048. the author of the GRASP animation package.
  1049.  
  1050. Bert Tyler, Timothy Wegner, and the rest of the Stone Soup Group
  1051. inspired several features and did some testing as well.
  1052.  
  1053. John Swenson, who knows more about how to use the program than even
  1054. I do, provided invaluable insights.
  1055.  
  1056. Thanks to Charles Marslett and STB Systems, Inc., for helping me
  1057. suuport HiColor boards such as STB's PowerGraph Ergo.
  1058.  
  1059. 'GIF' and 'Graphics Interchange Format' are trademarks of CompuServe
  1060. Incorporated, an H&R Block company.
  1061.  
  1062.  
  1063.  
  1064. Author
  1065. ======
  1066.  
  1067. Lee Daniel Crocker
  1068. 5506 Camden Ave #D3
  1069. San Jose, CA  95124
  1070.  
  1071. The best way to reach me is to type GO PICS on CompuServe and leave
  1072. mail to user ID [73407,2030].  I read these messages two or three
  1073. times a week.
  1074.  
  1075. I am also reachable on Usenet as "lee@mport.com" (uunet!mport!lee).
  1076.